package nc.task.hdysc;

import java.util.List;
import java.util.Map;

import nc.bs.dao.BaseDAO;
import nc.bs.dao.DAOException;
import nc.hdysc.engine.impl.BaseSyncDataImpl;
import nc.hdysc.engine.itf.ISyncTask;
import nc.hdysc.pub.BaseUtil;
import nc.jdbc.framework.processor.MapListProcessor;
import nc.vo.hdysc.engine.SyncTaskVO;
import nc.vo.hdysc.groupvaliddateset.GroupValidDateSetVO;

public class GroupValidDateSetTask extends BaseSyncDataImpl<GroupValidDateSetVO> implements ISyncTask<GroupValidDateSetVO>{

	public GroupValidDateSetTask() throws DAOException, InstantiationException, IllegalAccessException, ClassNotFoundException {
		super(GroupValidDateSetVO.class);
	}

	public GroupValidDateSetVO beforeUpdateOrInsert(GroupValidDateSetVO t) {
		return t;
	}

	public int compare(GroupValidDateSetVO sVO, GroupValidDateSetVO dVO) {
		int compare = -1;
		String dCompare = dVO.getPk_code().toString();
		String sCompare = sVO.getPk_code().toString();
		if(BaseUtil.equals(dCompare, sCompare)){
			compare = 1;
		}
		return compare;
	}

	public List<GroupValidDateSetVO> getDstDate() throws DAOException {
		List<GroupValidDateSetVO> groupValidDateSet = (List<GroupValidDateSetVO>)dDao.retrieveAll(GroupValidDateSetVO.class);
		return groupValidDateSet;
	}

	public List<Map<String, Object>> getSourceDate() throws DAOException {
		String sql = "select * from tbdGroupTypeExpire1";
		List<Map<String, Object>> groupValidDateSet = (List<Map<String,Object>>)sDao.executeQuery(sql, new MapListProcessor());
		return groupValidDateSet;
	}

	public SyncTaskVO getSyncTask() throws DAOException {
		SyncTaskVO syncTask = null;
		BaseDAO dao = new BaseDAO();
		syncTask = (SyncTaskVO) dao.retrieveByPK(SyncTaskVO.class, "0001AA1000000000ERO2");//0001AA1000000000D3GE
		return syncTask;
	}

}
